/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sasp_udp;

import sasp_messages.MessageHandler;
import sasp_messages.PINGCommand;

/**
 *
 * @author mauriello
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        PINGCommand ping = new PINGCommand(1, 2, 3);
        System.out.println("CMD - " + ping.toString());

        if( args.length == 1 ) {
            UDPTransceiver udpTrans = new UDPTransceiver( 12344 );
            MessageHandler messHandle = new MessageHandler( udpTrans );
            udpTrans.addUdpListener(messHandle);
            messHandle.sendPing(1);
            //System.out.println("Sending: " + args[0]);
            //udpTrans.transmitUdpMessage("127.0.0.1", UDPTransceiver.DEFAULT_PORT, ping.toString());
        } else {
            UDPTransceiver udpTrans = new UDPTransceiver( );
            MessageHandler messHandle = new MessageHandler( udpTrans );
            udpTrans.addUdpListener(messHandle);
        }

    }

}